Gets or sets the value of a data element in the data segment.
Syntax:
Parameters:
Remarks:
The values in data elements are the actual data in an EDI file. This property provides the ability to access and modify values on any data elements in the data segment by virtue of the element's identifier, or position in the collection, and its repeating instance.
The vElement and vSubElement parameters are variants whereby the identifier or the position can be passed. If an identifier is specified then it is passed as a string parameter; otherwise the position can be passed as a numeric parameter. The lRepeatInstance parameter is always passed as numeric.
For example, consider a data segment having the following data elements and associated values:
Position ID REQ Value 01 366 M AG 02 93 O CLARK KENT 02 93 O LOIS LANE 03 365 O 04 C034 O
Position ID REQ Value 01 1574 M DSS 02 1575 M ZZZ 04 C034 O
Position ID REQ Value 01 1574 M ISH 02 1575 M MD5 05 365 O 06 364 O 07 365 O 08 364 O 09 443 O The above data segment has the following notable properties:
- The data segment is defined to contain data in nine composite and simple elements.
- The element at position 04 with element ID "C034" is a composite element.
- The simple element "93" at position 02 has a repeating instance.
- The composite element at position 04 has a repeating instance.
- Data elements at position 05, 06, 07, 08, and 09 do not contain values.
Getting/Setting a value from a simple element
Any of the following statements can be used to get the value "AG" from the simple element "366" at position 1.
- sValue = oDataSegment.DateElementValue(1)
- sValue = oDataSegment.DateElementValue("366")
The following changes the value at simple element "366" at position 1 to "AA".
- oDataSegment.DateElementValue(1) = "AA"
- oDataSegment.DateElementValue("366") = "AA"
Getting/Setting a value from a repeating simple element
The following statements can be used to get the value "CLARK KENT" from the simple element "93" at position 2.
- sValue = oDataSegment.DateElementValue(2, 0, 1)
- sValue = oDataSegment.DateElementValue("93", "", 1)
The following gets the value "LOIS LANE" from second repeating instance.
- sValue = oDataSegment.DateElementValue(2, 0, 2)
- sValue = oDataSegment.DateElementValue("93", "", 2)
The following changes the value "CLARK KENT" to "JOHN SMITH", or "LOIS LANE" to "SALLY SIXPACK".
' Changes the data element value to JOHN SMITH.
- oDataSegment.DateElementValue(2, 0, 1) = "JOHN SMITH"
- oDataSegment.DateElementValue("93", "", 1) = "JOHN SMITH"
' Changes the data element value to SALLY SIXPACK.
- oDataSegment.DateElementValue(2, 0, 2) = "SALLY SIXPACK"
- oDataSegment.DateElementValue("93", "", 2) = "SALLY SIXPACK"
Getting/Setting a value from a component element in a composite element
Any of the following statements can be used to get the value "ZZZ" from the component element "1575" at position 2 of the composite element C034. The value is retrieved from the first repeating instance of the composite element. Because it is the first repeating instance, the lRepeatInstance parameter does not have to be specified because the first instance is expected by default.
- sValue = oDataSegment.DateElementValue(4, 2)
- sValue = oDataSegment.DateElementValue("C034", "1575")
- sValue = oDataSegment.DateElementValue(4, "1575")
- sValue = oDataSegment.DateElementValue("C034", 2)
Any of the following statements changes the value of the component element "1575" at position 2 of the composite element C034 to "SHA".
- oDataSegment.DateElementValue(4, 2) = "SHA"
- oDataSegment.DateElementValue("C034", "1575") = "SHA"
- oDataSegment.DateElementValue(4, "1575") = "SHA"
- oDataSegment.DateElementValue("C034", 2) = "SHA"
Getting/Setting a value from a component element in a repeating composite element
The following statements can be used to get the value "MD5" from the component element "1575" at position 2 of the composite element C034. The value is retrieved from the second repeating instance of the composite element. In this case, the lRepeatInstance parameter must be set to 2 to specify the second repeating instance of the composite.
- sValue = oDataSegment.DateElementValue(4, 2, 2)
- sValue = oDataSegment.DateElementValue("C034", "1575", 2)
- sValue = oDataSegment.DateElementValue(4, "1575", 2)
- sValue = oDataSegment.DateElementValue("C034", 2, 2)
Any of the following statements changes the value of the component element "1575" at position 2 of the composite element C034 to "MDC".
- oDataSegment.DateElementValue(4, 2, 2) = "MDC"
- oDataSegment.DateElementValue("C034", "1575", 2) = "MDC"
- oDataSegment.DateElementValue(4, "1575", 2) = "MDC"
- oDataSegment.DateElementValue("C034", 2, 2)= "MDC"
Sample